<?php

class DateUtil {
	public static function getAge($temp)
	{
	    if (empty($temp) || $temp == '0000-00-00')
	        return null;
	 
	    $temp = explode("-", $temp);
	    $oggi = explode("-", date("Y-m-d"));
	 
	    if ($oggi[1] > $temp[1])
	        return $oggi[0] - $temp[0];
	    elseif ($oggi[1] >= $temp[1] && $oggi[2] >= $temp[2])
	        return $oggi[0] - $temp[0];
	    else
	        return $oggi[0] - $temp[0] - 1;
	}
}

?>